package com.luoruihang.logstatementgenerator.domain.model;

import com.luoruihang.logstatementgenerator.domain.model.llmresponseformat.Message;

import java.util.ArrayList;
import java.util.List;

public class LlmRequest {

	// TODO 无论怎么改都会出现java代码之外的不必要文本，先搁置。使用中文偶尔会出现莫名其妙的乱码问题。
//	private String promotion = "generate a log statement or some log statements about code as follows(note: don't generate any texts but java code): ";
	private String promotion = "为下列java代码生成日志语句，保证原本代码不被修改，除了java代码文本外不要出现任何其他语句，" +
		"包括大模型本身的提示语句，保证在纯文本情况下不会出现任何其他字符，如果有，请在注释中生成：";
	private String model = "glm-4";

	private List<Message> messages = new ArrayList<>();

	public LlmRequest() {
	}

	public void setModel(String model) {
		this.model = model;
	}

	public String getModel() {
		return model;
	}

	public void addMessage(String role, String code) {
		Message message = new Message();
		message.setRole(role);

		String content = promotion + code;
		message.setContent(content);
		messages.add(message);
	}

	public void clearMessages() {
		messages = new ArrayList<>();
	}

	public List<Message> getMessages() {
		return messages;
	}

}
